﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Axis.Dao.Research;
using Axis.BusinessObject.Research;
using PhuLeBooze.Global;
using Axis.BusinessObject.Core;
using System.Text;
using Axis.Dao.Core;
using Axis.Dao.News;
namespace PhuLeBooze.Views.Project
{
    public partial class ListProject : System.Web.UI.Page
    {
        protected void LoadGift()
        {
            CCore cCore = new CCore();
            string inputValue = cCore.GetInputValue(Context);
            CResearchDao cResearchDao = new CResearchDao();
            IList<CGift> list = cResearchDao.GetGift(inputValue);
            StringBuilder ret=new StringBuilder();
            foreach (CGift gift in list)
            {
                ret.AppendFormat("<option value='{0}' groupid='{1}'>{2}</option>", gift.ID, gift.GroupID, gift.Name);
            }
            ltrGift.Text = ret.ToString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadGift();
                IList<CListData> giftGroup = new CCore().GetListData("GIFTGROUP");
                ddlGiftGroup.DataSource = giftGroup;
                ddlGiftGroup.DataTextField = "Name";
                ddlGiftGroup.DataValueField = "Value";
                ddlGiftGroup.DataBind();

                IList<CListData> userGroup = new CCore().GetListData("USERGROUP");
                ddlUserGroup.DataSource = userGroup;
                ddlUserGroup.DataTextField = "Name";
                ddlUserGroup.DataValueField = "Value";
                ddlUserGroup.DataBind();

                IList<CListData> listProject = new CCore().GetListData("ProjectRequiredField");
                if (listProject != null)
                {
                    ddlInfoRequire.DataSource = listProject;
                    ddlInfoRequire.DataTextField = "Name";
                    ddlInfoRequire.DataValueField = "Value";
                    ddlInfoRequire.DataBind();
                    ddlInfoRequire.Items.Insert(0, new ListItem("(all)", ""));
                }

                //<InputValue UserID="1" SecrectToken=”” ID="1" />
                IList<Axis.BusinessObject.News.CTag> allCloundTabs = new CNewsDao().GetTags(string.Format("<InputValue UserID='{0}' SecrectToken='{1}' RowsPerPage='2000' PageIndex='1'/>", CSecurity.USER_ID, CSecurity.SECRECT_TOKEN));
                 ddlTags.DataSource = allCloundTabs;
                ddlTags.DataTextField = "Text";
                ddlTags.DataValueField = "ID";
                ddlTags.DataBind();
                ddlTags.Items.Insert(0, new ListItem("(Tất cả)", "-100"));
            }
        }

    }
}